import tensorflow as tf

# 下载模型，并解压缩
def download_model(model_name):
    base_url = 'http://download.tensorflow.org/models/object_detection/tf2/20200713/'
    # 返回的是下载文件的路径
    model_dir = tf.keras.utils.get_file(fname=model_name,
                                        origin=base_url + model_name,
                                        # 是否需要解压
                                        untar=True)                                       
    return str(model_dir)


MODEL_NAME = 'centernet_hg104_512x512_coco17_tpu-8.tar.gz'
PATH_TO_MODEL_DIR = download_model(MODEL_NAME)
print(PATH_TO_MODEL_DIR)
